package com.bp.hearthealth.pulse.lnapps.bp_ui.bp_activity.bp_language_gender.bp_gender

import com.bp.hearthealth.pulse.lnapps.bp_db.bp_user.BpUserDao
import com.bp.hearthealth.pulse.lnapps.bp_network.BaseRepository
import com.bp.hearthealth.pulse.lnapps.bp_network.bp_api.ApiBpService
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.coroutineScope
import kotlinx.coroutines.withContext

class BpGenderRepository(private val userDao: BpUserDao, private val apiService: ApiBpService) :
    BaseRepository() {
    suspend fun updateBirthdayAndGenderInfo(
        userId: String, isFirstOpen: Boolean, birthday: String, gender: Int
    ) = withContext(Dispatchers.IO) {
        coroutineScope {
            try {
                userDao.updateBirthdayAndGenderInfo(
                    id = userId, isFirstOpen = isFirstOpen, birthday = birthday, gender = gender
                )
            } catch (e: Exception) {
                0
            }
        }
    }
}